Skip to content

Comments

Add profile file location management with policy support and rename folder location properties#3340

Merged
mergify[bot] merged 16 commits intomainfrom
copilot/add-profile-file-location-ui
Feb 22, 2026
Merged

Add profile file location management with policy support and rename folder location properties#3340
mergify[bot] merged 16 commits intomainfrom
copilot/add-profile-file-location-ui

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Changes proposed in this pull request

Implements the same folder location management for Profiles that PR #3324 added for Settings: user-selectable location via UI, admin-enforced location via system-wide policy, with validation, restart-on-change, and graceful fallback.

Also renames policy/local-settings properties to follow the Section_SettingName convention consistently.

Profile location management (mirrors Settings implementation):

  • ProfileManager.GetProfilesFolderLocation() now resolves with priority: Policy → Custom user path → Default/Portable
  • Added GetDefaultProfilesFolderLocation(), GetPortableProfilesFolderLocation(), ValidateProfilesFolderPath() with full error handling
  • SettingsInfo.Profiles_FolderLocation stores user-selected path (in main settings, not LocalSettingsInfo — settings file is already loaded when profile location is needed)
  • PolicyInfo.Profiles_FolderLocation for admin-enforced path via config.json
  • Profiles are saved at the current location before changing the folder location to prevent unintended writes to the new location during shutdown/restart

UI (SettingsProfilesView):

  • Replaced read-only textbox with editable textbox + browse button + drag-drop
  • Change / Restore Default Location buttons with confirmation dialog + app restart
  • Shield icon + "managed by administrator" message when policy-controlled
  • Portable version info message + disabled controls when applicable
  • IsDefaultLocation recalculated when Location changes so the Restore Default button visibility stays in sync

Property renames:

  • SettingsFolderLocationSettings_FolderLocation (PolicyInfo, LocalSettingsInfo, all references)
  • ProfilesFolderLocationProfiles_FolderLocation (PolicyInfo, all references)
  • Backward-compatible deserialization for SettingsFolderLocation in LocalSettingsInfo via [JsonPropertyName] legacy property
  • Breaking change noted in changelog for admin config.json deployments

config.json example:

{
  "Update_CheckForUpdatesAtStartup": false,
  "Settings_FolderLocation": "C:\\CustomPath\\NETworkManager\\Settings",
  "Profiles_FolderLocation": "C:\\CustomPath\\NETworkManager\\Profiles"
}

Related issue(s)

Based on PR #3324

Close #2787
Close #3208

Copilot generated summary

Copilot summary

This PR adds profile file location management matching the existing settings folder location feature from PR #3324. The ProfileManager.GetProfilesFolderLocation() method now implements a three-tier priority system (policy override → custom user path → default/portable fallback) with comprehensive path validation. The Settings > Profiles UI is updated with an editable location textbox, browse/drag-drop support, change/restore buttons, and admin policy indicators. Profiles are explicitly saved before changing the folder location to prevent writes to the wrong path during app restart. Policy properties are renamed from SettingsFolderLocation/ProfilesFolderLocation to Settings_FolderLocation/Profiles_FolderLocation for naming consistency, with backward-compatible deserialization for existing local settings files. Documentation updated across profiles.md, settings.md, system-wide-policies.md, and the changelog.

To-Do

Contributing

By submitting this pull request, I confirm the following:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…older location properties

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add profile file location change functionality in UI Add profile file location management with policy support and rename folder location properties Feb 20, 2026
Copilot AI requested a review from BornToBeRoot February 20, 2026 22:56
@BornToBeRoot BornToBeRoot marked this pull request as ready for review February 20, 2026 22:57
Copilot AI review requested due to automatic review settings February 20, 2026 22:57
@github-actions github-actions bot added this to the next-release milestone Feb 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds profile folder location management (user-configurable with restart + admin policy override) analogous to the existing settings folder location feature, and renames policy/local-settings JSON properties to consistently follow the Section_SettingName convention.

Changes:

  • Implement policy/custom/default resolution + validation for the profiles folder path.
  • Update the Profiles settings UI to allow editing/browsing/drag-drop, with policy/portable-mode disabling and restart-on-change flows.
  • Rename policy/local-settings JSON property names (SettingsFolderLocationSettings_FolderLocation, ProfilesFolderLocationProfiles_FolderLocation) and update docs/examples accordingly.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
Website/docs/system-wide-policies.md Updates policy example JSON key for settings folder location.
Website/docs/settings/settings.md Updates documented policy property name for settings folder location.
Website/docs/settings/profiles.md Documents new profiles folder location system-wide policy with examples.
Website/docs/changelog/next-release.md Adds changelog entries for new profiles folder location capability/policy.
Source/NETworkManager/Views/SettingsProfilesView.xaml.cs Adds drag/drop handlers for the profiles location textbox.
Source/NETworkManager/Views/SettingsProfilesView.xaml Reworks the Profiles location UI (editable path, browse button, policy/portable indicators, change/restore actions).
Source/NETworkManager/ViewModels/SettingsSettingsViewModel.cs Updates references to renamed settings policy/local-settings property.
Source/NETworkManager/ViewModels/SettingsProfilesViewModel.cs Adds Profiles location state + commands for browse/change/restore with restart flow.
Source/NETworkManager.Settings/config.json.example Updates example config to new key names and adds profiles folder location key.
Source/NETworkManager.Settings/SettingsManager.cs Renames settings folder location policy/local-settings references + log messages.
Source/NETworkManager.Settings/SettingsInfo.cs Adds persisted user setting for custom profiles folder location.
Source/NETworkManager.Settings/PolicyManager.cs Logs new policy property names (settings + profiles).
Source/NETworkManager.Settings/PolicyInfo.cs Renames settings policy JSON key and adds profiles policy JSON key.
Source/NETworkManager.Settings/LocalSettingsInfo.cs Renames local-settings property for settings folder location.
Source/NETworkManager.Profiles/ProfileManager.cs Implements policy/custom/default resolution + validation for profiles folder location.
Source/NETworkManager.Localization/Resources/Strings.resx Adds localized strings for profiles location change/restore confirmation dialogs.
Source/NETworkManager.Localization/Resources/Strings.Designer.cs Updates designer for the new localization keys.
Files not reviewed (1)
  • Source/NETworkManager.Localization/Resources/Strings.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 22 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • Source/NETworkManager.Localization/Resources/Strings.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


/// <summary>
/// Prompts the user to confirm and then changes the location of the application's settings folder.
/// Prompts the user to confirm and then changes the location of the profiles folder.
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The XML doc comment says this method changes the location of the profiles folder, but this is the Settings view model and the dialog/message targets the settings folder. Please update the comment to avoid confusion for future maintenance.

Suggested change
/// Prompts the user to confirm and then changes the location of the profiles folder.
/// Prompts the user to confirm and then change the location of the settings folder.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a73415c — updated the doc comment to say "settings folder".

Comment on lines +273 to +277
// Set new location in SettingsInfo
SettingsManager.Current.Profiles_FolderLocation = Location;

// Restart the application
(Application.Current.MainWindow as MainWindow)?.RestartApplication();
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing SettingsManager.Current.Profiles_FolderLocation here immediately changes what ProfileManager.GetProfilesFolderLocation() returns. During shutdown (triggered by RestartApplication()), ProfileManager.Save() uses GetProfilesFolderLocation() to create the profiles directory and to decide the backup folder, but still writes to LoadedProfileFile.Path (old path). This can create backups/directories in the new location while writing the profile file in the old location. Consider saving/unloading profiles before flipping the setting, or deferring application of the new location until next startup (similar to how the settings-location change avoids unintended writes).

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot So ProfileManager.Save() before SettingsManager.Current.Profiles_FolderLocation = Location; would fix it? If yes, fix it. The profile will not be changed between the SettingsManager.Current.Profiles_FolderLocation = Location; and the restart.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a73415c — added ProfileManager.Save() before changing Profiles_FolderLocation in both ChangeLocationAction() and RestoreDefaultLocationActionAsync().

…h, fix doc comment

Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com>
@mergify mergify bot merged commit 6791337 into main Feb 22, 2026
4 checks passed
@mergify mergify bot deleted the copilot/add-profile-file-location-ui branch February 22, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote Location Profiles Custom configuration file location

2 participants